package org.ru.mse10.cvis.entity.cv;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.ru.mse10.cvis.entity.misc.DateRange;
import org.ru.mse10.cvis.entity.misc.Identity;

/**
 * The Class YearsWithinACompany.
 */
@Entity
@Table(name = "years_within_company")
public class YearsWithinACompany extends Identity {

	/** The company. */
	private String company;

	/** The years. */
	private DateRange years;

	/** The cv data. */
	private CvData cvData;

	/**
	 * Gets the company.
	 * 
	 * @return the company
	 */
	public String getCompany() {
		return company;
	}

	/**
	 * Sets the company.
	 * 
	 * @param company
	 *            the new company
	 */
	public void setCompany(String company) {
		this.company = company;
	}

	/**
	 * Gets the years.
	 * 
	 * @return the years
	 */
	@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
	public DateRange getYears() {
		return years;
	}

	/**
	 * Sets the years.
	 * 
	 * @param years
	 *            the new years
	 */
	public void setYears(DateRange years) {
		this.years = years;
	}

	/**
	 * Gets the cv data.
	 * 
	 * @return the cv data
	 */
	@ManyToOne
	public CvData getCvData() {
		return cvData;
	}

	/**
	 * Sets the cv data.
	 * 
	 * @param cvData
	 *            the new cv data
	 */
	public void setCvData(CvData cvData) {
		this.cvData = cvData;
	}

}
